/**
 * 
 */
package com.gragra.nounIdentification;
import com.gragra.frameStatistics.StatisticsGenerator;
import com.gragra.util.StringToInt;
/**
 * this extends the log scaled weighting by also scaling the initial score  by the logarithm of the frequency
 * @author Christoph Teichmann
 * created Mar 26, 2013 11:47:05 AM
 * @version 0.1
 */
public class TypesPerTokenInitialLogWeighted extends TypesPerTokenLogWeighted
{
	/* (non-Javadoc)
	 * @see com.gragra.nounIdentification.TypesPerTokenScorer#intialScore(com.gragra.frameStatistics.StatisticsGenerator, int)
	 */
	@Override
	protected double intialScore(StatisticsGenerator sg, int frame)
	{
		String one = StringToInt.reverse(sg.getFrameStructure(frame)[0]);
		String two = StringToInt.reverse(sg.getFrameStructure(frame)[2]);
		if(one.matches("(\\p{Punct}|\\*.*\\*)+"))
		{return 0.0;}
		if(two.matches("(\\p{Punct}|\\*.*\\*)+"))
		{return 0.0;}
		double freq = Math.log(sg.getFrameFrequency(frame));
		return (-((double) sg.getCoOccurringWords(frame).size()/freq)*Math.log(freq+1));
	}
}